

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>3.7. Leaflet identification — MDAnalysis.analysis.leaflet &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="3. Analysis modules" href="../analysis_modules.html" />
    <link rel="next" title="4. Topology modules" href="../topology_modules.html" />
    <link rel="prev" title="3.6. HELANAL — analysis of protein helices" href="helanal.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../topology_modules.html" title="4. Topology modules"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="helanal.html" title="3.6. HELANAL — analysis of protein helices"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../analysis_modules.html" accesskey="U">3. Analysis modules</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="helanal.html"
                        title="previous chapter">3.6. HELANAL &#8212; analysis of protein helices</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../topology_modules.html"
                        title="next chapter">4. Topology modules</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/analysis/leaflet.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.analysis.leaflet"></span><div class="section" id="leaflet-identification-mdanalysis-analysis-leaflet">
<h1>3.7. Leaflet identification &#8212; <a class="reference internal" href="#module-MDAnalysis.analysis.leaflet" title="MDAnalysis.analysis.leaflet"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.analysis.leaflet</span></tt></a><a class="headerlink" href="#leaflet-identification-mdanalysis-analysis-leaflet" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Author:</th><td class="field-body">Oliver Beckstein</td>
</tr>
<tr class="field"><th class="field-name">Year:</th><td class="field-body">2010</td>
</tr>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">GNU Public License v3</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Algorithm:</dt>
<dd><ol class="first last arabic simple">
<li>build a graph of all phosphate distances &lt; cutoff</li>
<li>identify the largest connected subgraphs</li>
<li>analyse first and second largest graph, which correspond to the leaflets</li>
</ol>
</dd>
</dl>
<p>One can use this information to identify</p>
<ul class="simple">
<li>the upper and lower leaflet of a <em>planar membrane</em> by comparing the
the <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup.centerOfGeometry" title="MDAnalysis.core.AtomGroup.AtomGroup.centerOfGeometry"><tt class="xref py py-meth docutils literal"><span class="pre">centerOfGeometry()</span></tt></a> of
the leaflet groups, or</li>
<li>the outer and inner leaflet of a <em>vesicle</em> by comparing histograms
of distances from the centre of geometry (or possibly simply the
<a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup.radiusOfGyration" title="MDAnalysis.core.AtomGroup.AtomGroup.radiusOfGyration"><tt class="xref py py-meth docutils literal"><span class="pre">radiusOfGyration()</span></tt></a>).</li>
</ul>
<p>See example scripts in the <tt class="docutils literal"><span class="pre">examples/</span></tt> directory on how to use
<a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder" title="MDAnalysis.analysis.leaflet.LeafletFinder"><tt class="xref py py-class docutils literal"><span class="pre">LeafletFinder</span></tt></a>. The function <a class="reference internal" href="#MDAnalysis.analysis.leaflet.optimize_cutoff" title="MDAnalysis.analysis.leaflet.optimize_cutoff"><tt class="xref py py-func docutils literal"><span class="pre">optimize_cutoff()</span></tt></a> implements a
(slow) heuristic method to find the best cut off for the LeafletFinder
algorithm.</p>
<dl class="class">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder">
<em class="property">class </em><tt class="descclassname">MDAnalysis.analysis.leaflet.</tt><tt class="descname">LeafletFinder</tt><big>(</big><em>universe</em>, <em>selectionstring</em>, <em>cutoff=15.0</em>, <em>pbc=False</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder" title="Permalink to this definition">¶</a></dt>
<dd><p>Identify atoms in the same leaflet of a lipid bilayer.</p>
<p>The components of the graph are stored in the list
<tt class="xref py py-attr docutils literal"><span class="pre">LeafletFinder.components</span></tt>; the atoms in each component are numbered
consecutively, starting at 0. To obtain the atoms in the input structure
use <a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder.groups" title="MDAnalysis.analysis.leaflet.LeafletFinder.groups"><tt class="xref py py-meth docutils literal"><span class="pre">LeafletFinder.groups()</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">L</span> <span class="o">=</span> <span class="n">LeafletFinder</span><span class="p">(</span><span class="n">PDB</span><span class="p">,</span> <span class="s">&#39;name P*&#39;</span><span class="p">)</span>
<span class="n">leaflet0</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">groups</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="n">leaflet1</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">groups</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>The residues can be accessed through the standard MDAnalysis mechanism:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">leaflet0</span><span class="o">.</span><span class="n">residues</span>
</pre></div>
</div>
<p>provides a <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.ResidueGroup" title="MDAnalysis.core.AtomGroup.ResidueGroup"><tt class="xref py py-class docutils literal"><span class="pre">ResidueGroup</span></tt></a>
instance. Similarly, all atoms in the first leaflet are then</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">leaflet0</span><span class="o">.</span><span class="n">residues</span><span class="o">.</span><span class="n">atoms</span>
</pre></div>
</div>
<p>Initialize from a <em>universe</em> or pdb file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first docutils">
<dt><em>universe</em></dt>
<dd><p class="first last"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.Universe</span></tt> or a PDB file name.</p>
</dd>
<dt><em>selectionstring</em></dt>
<dd><p class="first last"><tt class="xref py py-meth docutils literal"><span class="pre">MDAnalysis.Universe.selectAtoms()</span></tt> selection
for atoms that define the lipid head groups, e.g.
&#8220;name PO4&#8221; or &#8220;name P*&#8221;</p>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Keywords :</th><td class="field-body"><dl class="first last docutils">
<dt><em>cutoff</em></dt>
<dd><p class="first last">head group-defining atoms within a distance of <em>cutoff</em>
Angstroms are deemed to be in the same leaflet [15.0]</p>
</dd>
<dt><em>pbc</em></dt>
<dd><p class="first last">take periodic boundary conditions into account (only works
for orthorhombic boxes) [<tt class="xref docutils literal"><span class="pre">False</span></tt>]</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.group">
<tt class="descname">group</tt><big>(</big><em>component_index</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.group" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup" title="MDAnalysis.core.AtomGroup.AtomGroup"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.AtomGroup.AtomGroup</span></tt></a> for <em>component_index</em>.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.groups">
<tt class="descname">groups</tt><big>(</big><em>component_index=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.groups" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup" title="MDAnalysis.core.AtomGroup.AtomGroup"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.AtomGroup.AtomGroup</span></tt></a> for <em>component_index</em>.</p>
<p>If no argument is supplied, then a list of all leaflet groups is returned.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder.group" title="MDAnalysis.analysis.leaflet.LeafletFinder.group"><tt class="xref py py-meth docutils literal"><span class="pre">LeafletFinder.group()</span></tt></a> and <a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder.groups_iter" title="MDAnalysis.analysis.leaflet.LeafletFinder.groups_iter"><tt class="xref py py-meth docutils literal"><span class="pre">LeafletFinder.groups_iter()</span></tt></a></p>
</div>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.groups_iter">
<tt class="descname">groups_iter</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.groups_iter" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterator over all leaflet <a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder.groups" title="MDAnalysis.analysis.leaflet.LeafletFinder.groups"><tt class="xref py py-meth docutils literal"><span class="pre">groups()</span></tt></a></p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.sizes">
<tt class="descname">sizes</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.sizes" title="Permalink to this definition">¶</a></dt>
<dd><p>Dict of component index with size of component.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.update">
<tt class="descname">update</tt><big>(</big><em>cutoff=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update components, possibly with a different <em>cutoff</em></p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.leaflet.LeafletFinder.write_selection">
<tt class="descname">write_selection</tt><big>(</big><em>filename</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.LeafletFinder.write_selection" title="Permalink to this definition">¶</a></dt>
<dd><p>Write selections for the leaflets to <em>filename</em>.</p>
<p>The format is typically determined by the extension of <em>filename</em>
(e.g. &#8220;vmd&#8221;, &#8220;pml&#8221;, or &#8220;ndx&#8221; for VMD, PyMol, or Gromacs).</p>
<p>See <a class="reference internal" href="../selections/base.html#MDAnalysis.selections.base.SelectionWriter" title="MDAnalysis.selections.base.SelectionWriter"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.selections.base.SelectionWriter</span></tt></a> for all
options.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="MDAnalysis.analysis.leaflet.optimize_cutoff">
<tt class="descclassname">MDAnalysis.analysis.leaflet.</tt><tt class="descname">optimize_cutoff</tt><big>(</big><em>universe</em>, <em>selection</em>, <em>dmin=10.0</em>, <em>dmax=20.0</em>, <em>step=0.5</em>, <em>max_imbalance=0.20000000000000001</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.leaflet.optimize_cutoff" title="Permalink to this definition">¶</a></dt>
<dd><p>Find cutoff that minimizes number of disconnected groups.</p>
<p>Applies heuristics to find best groups:</p>
<ol class="arabic">
<li><p class="first">at least two groups (assumes that there are at least 2 leaflets)</p>
</li>
<li><p class="first">reject any solutions for which:</p>
<blockquote>
<div><p><cite>|N0 - N1|/|N0 + N1| &gt; *max_imbalance*</cite></p>
</div></blockquote>
<p>Ni = number of lipids in group i. This heuristic picks groups with
balanced numbers of lipids.</p>
</li>
</ol>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first docutils">
<dt><em>universe</em></dt>
<dd><p class="first last"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.Universe</span></tt> instance</p>
</dd>
<dt><em>selection</em></dt>
<dd><p class="first last">selection string as used for <a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder" title="MDAnalysis.analysis.leaflet.LeafletFinder"><tt class="xref py py-class docutils literal"><span class="pre">LeafletFinder</span></tt></a></p>
</dd>
<dt><em>dmin</em>, <em>dmax</em>, <em>step</em></dt>
<dd><p class="first last">scan cutoffs from <em>dmin</em> to <em>dmax</em> at stepsize*step (in Angstroms)</p>
</dd>
<dt><em>max_imbalance</em></dt>
<dd><p class="first last">tuning parameter for the balancing heuristic (2) [0.2]</p>
</dd>
<dt><em>kwargs</em></dt>
<dd><p class="first last">other arguments for  <a class="reference internal" href="#MDAnalysis.analysis.leaflet.LeafletFinder" title="MDAnalysis.analysis.leaflet.LeafletFinder"><tt class="xref py py-class docutils literal"><span class="pre">LeafletFinder</span></tt></a></p>
</dd>
</dl>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">(cutoff,N)</span></tt> optimum cutoff and number of groups found</p>
</td>
</tr>
<tr class="field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last">can die in various ways if really no appropriate number of groups
can be found; needs to be made more robust</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../topology_modules.html" title="4. Topology modules"
             >next</a> |</li>
        <li class="right" >
          <a href="helanal.html" title="3.6. HELANAL — analysis of protein helices"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../analysis_modules.html" >3. Analysis modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>